package com.csust.travel.mapper;

import com.csust.travel.entity.Sellers;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface SellersMapper {
    @Select("select * from sellers")
    List<Sellers> findAllItem();

    @Delete("delete from sellers where id = #{id}")
    void delItem(Integer id);

    @Insert("insert into sellers values(null,#{name},#{college},#{major},#{phonenumber},#{qqnumber},#{sex},#{seller_code})")
    void saveItem(Sellers item);

    @Select("select * from sellers where id = #{id}")
    Sellers findOne(Integer id);

    @Update("update sellers set seller_code=#{seller_code},name=#{name},college =#{college},major=#{major} ,phonenumber=#{phonenumber},qqnumber=#{qqnumber},sex=#{sex} where id = #{id}")
    void editItem(Sellers item);

    @Select("select * from sellers where seller_code = #{string} or name like concat('%',#{string},'%') or phonenumber =#{string}")
    List<Sellers> findByString(String string);
}
